package com.itheima.day08.myMap.test2;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/*
    Map集合第一种遍历方式
 */
public class Test {
    public static void main(String[] args) {
        // 创建Map集合，并添加元素
        Map<String, String> map = new HashMap<>();
        map.put("itheima001","张三");
        map.put("itheima002","李四");
        map.put("itheima003","王五");
        map.put("itheima004","赵六");
        map.put("itheima005","张三");

        // 获取集合中所有的键
        Set<String> keys = map.keySet();

        // 遍历集合用对应的键获取对应的值
        for (String key : keys) {
            String value = map.get(key);
            System.out.println(key + "------" + value);
        }
    }
}
